/*
 * FlightController_Defaults.h
 *
 *  Created on: Jan 19, 2014
 *      Author: ppks
 */

#ifndef FLIGHTCONTROLLER_DEFAULTS_H_
#define FLIGHTCONTROLLER_DEFAULTS_H_

#include "FlightController_Calibration.h"

/********************************************************************************/
/* PID Config Default Values                                                    */
/********************************************************************************/
/* default POSHOLD control gains */
#define POSHOLD_P              .11
#define POSHOLD_I              0.0
#define POSHOLD_IMAX           20        /* degrees */

#define POSHOLD_RATE_P         2.0
#define POSHOLD_RATE_I         0.08      /* Wind control */
#define POSHOLD_RATE_D         0.045     /* try 2 or 3 for POSHOLD_RATE 1 */
#define POSHOLD_RATE_IMAX      20        /* degrees */

/* default Navigation PID gains */
#define NAV_P                  2.5
#define NAV_I                  0.20      /* Wind control */
#define NAV_D                  0.08
#define NAV_IMAX               20        /* degrees */

#define PID_CONFIG_DEFAULTS_1 \
{ \
    {33, 30, 23},       /* PID_ROLL */ \
    {33, 30, 23},       /* PID_PITCH */ \
    {90, 10, 100},      /* PID_LEVEL */ \
    {68, 45, 0},        /* PID_YAW */ \
    {64, 25, 24},       /* PID_ALT */ \
    {POSHOLD_P * 100,     POSHOLD_I * 100,      0},                         /* PID_POS */ \
    {POSHOLD_RATE_P * 10, POSHOLD_RATE_I * 100, POSHOLD_RATE_D * 1000},     /* PID_POSR */ \
    {NAV_P * 10,          NAV_I * 100,          NAV_D * 1000},              /* PID_NAVR */ \
    {40, 0, 0},         /* PID_MAG */ \
    {0,  0, 0},         /* PID_VEL */ \
}

#define PID_CONFIG_DEFAULTS_2 \
{ \
    {28, 10, 7},       /* PID_ROLL */ \
    {28, 10, 7},       /* PID_PITCH */ \
    {30, 32, 0},      /* PID_LEVEL */ \
    {68, 45, 0},        /* PID_YAW */ \
    {64, 25, 24},       /* PID_ALT */ \
    {POSHOLD_P * 100,     POSHOLD_I * 100,      0},                         /* PID_POS */ \
    {POSHOLD_RATE_P * 10, POSHOLD_RATE_I * 100, POSHOLD_RATE_D * 1000},     /* PID_POSR */ \
    {NAV_P * 10,          NAV_I * 100,          NAV_D * 1000},              /* PID_NAVR */ \
    {40, 0, 0},         /* PID_MAG */ \
    {0,  0, 0},         /* PID_VEL */ \
}

/********************************************************************************/
/* RC Tuning Default Values                                                     */
/********************************************************************************/
#define RC_TUNING_CONFIG_DEFAULTS \
{ \
    90,     /* uint8_t rcRate8          */ \
    65,     /* uint8_t rcExpo8          */ \
    0,      /* uint8_t rollPitchRate    */ \
    0,      /* uint8_t yawRate          */ \
    0,      /* uint8_t dynThrPID        */ \
    50,     /* uint8_t thrMid8 */ \
    0,      /* uint8_t thrExpo8 */ \
    {0,0},  /* int16_t angleTrim[] */ \
}

#endif /* FLIGHTCONTROLLER_DEFAULTS_H_ */
